﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DoAnASP;
using System.Data;

public partial class WebMasterPage : System.Web.UI.MasterPage
{

    protected void Page_Load(object sender, EventArgs e)
    {

        
        //lbl_SoLuongKhach.Text = Application["SoLuongTruyCap"].ToString();
        //if ((bool)Session["DaDangNhap"] == false)
        //{
        //    Panel_DangNhap.Visible = true;
        //    Label lblChao = new Label();
        //    lblChao.Text = "Chào khách | ";
        //    HyperLink hplDangNhap = new HyperLink();
        //    hplDangNhap.Text = "Đăng nhập";
        //    Label lbl3 = new Label();
        //    lbl3.Text = " | ";
        //    hplDangNhap.NavigateUrl = "DangNhap.aspx";

        //    HyperLink hplDangKi = new HyperLink();
        //    hplDangKi.Text = "Đăng kí";
        //    hplDangKi.NavigateUrl = "~/DangKi.aspx";

        //    tdChao.Controls.Add(lblChao);
        //    tdChao.Controls.Add(hplDangNhap);
        //    tdChao.Controls.Add(lbl3);
        //    tdChao.Controls.Add(hplDangKi);
        //}
        //else
        //{
        //    Panel_DangNhap.Visible = false;
        //    Label lblChao = new Label();
        //    lblChao.Text = "Chào: " + Session["HoTen"] + " | ";

        //    HyperLink hplDoiMatKhau = new HyperLink();
        //    hplDoiMatKhau.Text = "Đổi mật khẩu";
        //    hplDoiMatKhau.NavigateUrl = "~/DoiMatKhau.aspx";
        //    Label lbl1 = new Label();
        //    lbl1.Text = " | ";
        //    LinkButton lbtThoat = new LinkButton();
        //    lbtThoat.Text = "Thoát";
        //    Label lbl2 = new Label();
        //    lbl2.Text = " | ";
        //    tdChao.Controls.Add(lblChao);
        //    tdChao.Controls.Add(hplDoiMatKhau);
        //    tdChao.Controls.Add(lbl1);
        //    tdChao.Controls.Add(lbtThoat);
        //    tdChao.Controls.Add(lbl2);
        //    int maquyen = DB.LayMaQuyen(Session["TenDangNhap"].ToString());
        //    if (maquyen == 1)
        //    {
        //        HyperLink hplQuanTri = new HyperLink();
        //        hplQuanTri.Text = "Trang quản trị viên";
        //        hplQuanTri.NavigateUrl = "~/Admin/HomeAdmin.aspx";
        //        tdChao.Controls.Add(hplQuanTri);
        //    }
        //    lbtThoat.Click += new EventHandler(lbtThoat_Click);
        //}
        Load_Thuonghieu();
    }
    private void Load_Thuonghieu()
    {
        BUS_ThuongHieu busTH = new BUS_ThuongHieu();
        DataTable dt = new DataTable();
        dt = busTH.Load_Thuonghieu();
        DataList2.DataSource = dt.DefaultView;
        DataList2.DataBind();
    }
    void lbtThoat_Click(object sender, EventArgs e)
    {
        Session["DaDangNhap"] = false;
        Response.Redirect(Request.RawUrl);
    }
    protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
    {
        
    }
    //protected void ImageButton3_Click1(object sender, ImageClickEventArgs e)
    //{
    //    //string ID_Loai = drl_LoaiSP.SelectedValue.ToString();
        
    //    //    if ((txb_GiaTu.Text != "") && (txb_Den.Text == ""))
    //    //    {
    //    //        Session["sqlseach"] = "select * from tbl_SanPham Where ID_Loai = '" + ID_Loai + "' and Gia > '" + txb_GiaTu.Text + "'";
    //    //    }
    //    //    if ((txb_GiaTu.Text == "") && (txb_Den.Text != ""))
    //    //    {
    //    //        Session["sqlseach"] = "select * from tbl_SanPham Where ID_Loai = '" + ID_Loai + "' and Gia < '" + txb_Den.Text + "'";
    //    //    }
    //    //    if ((txb_GiaTu.Text == "") && (txb_Den.Text == ""))
    //    //    {
    //    //        Session["sqlseach"] = "select * from tbl_SanPham Where ID_Loai = '" + ID_Loai + "'";
    //    //    }
    //    //    if ((txb_GiaTu.Text != "") && (txb_Den.Text != ""))
    //    //    {
    //    //        Session["sqlseach"] = "select * from tbl_SanPham Where ID_Loai = '" + ID_Loai + "' and Gia between'" + txb_GiaTu.Text + "' and '" + txb_Den.Text + "'";
    //    //    }
    //    //    Response.Redirect("~/TimKiemSP.aspx?ID_Loai=" + ID_Loai + "&s=0");
    //}
    protected void ImageButton1_Click1(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("TrangChu.aspx");
    }
    protected void ImageButton2_Click1(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("GioHang.aspx");
    }
    protected void ImageButton4_Click(object sender, ImageClickEventArgs e)
    {
        //if (txb_SeachName.Text == "")
        //{
        //    return;
        //}
        //Session["sqlseach"] = "select * from tbl_SanPham Where TenSP like '%" + txb_SeachName.Text + "%'";
        //Response.Redirect("~/TimKiemSP.aspx?s=0");
    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        //bool ok = DB.KTDangNhap(txtTenDangNhap.Text, txtMatKhau.Text);
        //if (ok)
        //{
        //    Session["DaDangNhap"] = true;
        //    Session["TenDangNhap"] = txtTenDangNhap.Text;
        //    Session["HoTen"] = DB.LayHoTen(txtTenDangNhap.Text);
        //    Response.Redirect("~/TrangChu.aspx");
        //}
        //else
        //{
        //    lbl_ThongBaoDN.Visible = true;
        //}
    }


}
